import os, cgi
import pymysql as db

conn = db.connect (host = "localhost",
            user = "student",
            passwd = "anything",
            db = "emanuelacademy")
cursor = conn.cursor()

userDicts = []

def getUserTable():
        tempDict = {}
	cursor.execute("SELECT * FROM users WHERE teacher > '1'")
	rows = cursor.fetchall()
        for user in rows:
            tempDict = {'userID':user[0],
                        'username':user[1],
                        'alias':user[2],
                        'totalPoints':user[3],
                        'position':user[4],
                        'streak':user[5],
                        'correct':user[6],
                        'attempted':user[7]}
            userDicts.append(tempDict)
        return userDicts
	
